package team.headnurse.nursemanagement.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import team.headnurse.nursemanagement.model.Login;
import team.headnurse.nursemanagement.service.LoginService;

@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;

    @RequestMapping("/login")
    public String login(Login login){
        String res=loginService.findPassword(login.getStaff_id());
        if (login.getPassword().equals(res)) return login.getStaff_id();
        else return "error";
    }
}
